########################sketch of a map handler
#### characters will store current map and map location.
# That can be fed into this so that it can also remember who is in what place
#maps are just listed by numbers
#0,0 is always starting thing (map 0, room 0)
#map exists in SQL database? can load and write to?
#maps are basic map ID and then a room. each room then has a list of exits, objects, etc. actual coords of things are handled on map db (so if map changes, player data is fine)
import pymysql
import configurethis
cfgstuff = configurethis.Configit()




class Mappy:
    stuff = cfgstuff.dbpas
    stuffu = cfgstuff.dbuser
    stuffp = cfgstuff.dbport
    stuffhost = cfgstuff.dbhost
    sqldebug = True
    try:
        connsql = pymysql.connect(host= stuffhost, port=stuffp, user=stuffu, passwd= stuff, db='muddymoon', )
        connsqldict = pymysql.connect(host=stuffhost, port=stuffp, user=stuffu, passwd= stuff, db='muddymoon', cursorclass=pymysql.cursors.DictCursor)
    
        cursor = connsql.cursor()
        cursord = connsqldict.cursor()
    except pymysql.err.OperationalError:
        print("ERROR ERROR ERROR")
        print("Access denied to DB or some other DB related error, fix user name or password to the db. maybe port?")
        quit()

    def __init__(self, mapwide, mapheight, maptype, mapname):
        self.maptype = maptype
        self.mappy  = [[0 for a in range(g_area_wide)] for b in range(g_area_height)]

    def setcell(self, cell,coords):
        pass
    def checkcell(self, cell):
        return cell
    #something to set where players go def setentrance?

    def process_move(self):
        #takes player dict with move commands?
        #hmm idk how to handle maps as objects. how do players move between?
        #maybe player dict will have a current map and location, maps can define things in maps like warps?

        pass
    def process_input(self,inputdict):
        #recieve the dict and figure out where player is, register in local memory location
        #use something like.... a dict that stores player, map and room as a dict that can reference dicts?
        
        pass

    def check_global_plist(self, player):
        #checks entire list if player exists. say, for tells.
        pass
    def check_local_plist(self, chara, charb):
        #checks if chara is in same room as b,
        
        pass

    def room_chats(self):
        #looks up each player in a room and sends them that message if it is supposed to be in that chat

    def process_look(self):
        #look happens here because it has to describe the locale and will know which players are around, so we can store the description here.
        
